package com.ruyuan.seckilling.activity.request;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @author zhonghuashishan
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ActivitySkuRefSaveRequest {

    private Long activityId;

    private Long skuId;

    private Integer price;

    private Integer seckillingStock;

    public String validateParams() {
        if (Objects.isNull(activityId) || activityId <= 0) {
            return "活动不合法";
        }
        if (Objects.isNull(skuId) || skuId <= 0) {
            return "商品不合法";
        }
        if (Objects.isNull(price) || price < 0) {
            return "商品原价不合法";
        }
        if (Objects.isNull(seckillingStock) || seckillingStock <= 0) {
            return "商品秒杀数量不合法";
        }
        return null;
    }
}
